#import "OneViewController.h"
#import "TwoViewController.h"
#import "ThreeViewController.h"
#import "MainViewController.h"
@interface MainViewController ()
@property (nonatomic,strong)OneViewController *one;
@property (nonatomic,strong)TwoViewController *two;
@property (nonatomic,strong)ThreeViewController *three;
@end

@implementation MainViewController

- (OneViewController *)one
{
    if (!_one) {
        _one = [[OneViewController alloc]init];
    }
    return _one;
}
- (TwoViewController *)two
{
    if (!_two) {
        _two = [[TwoViewController alloc]init];
    }
    return _two;
}
- (ThreeViewController *)three
{
    if (!_three) {
        _three = [[ThreeViewController alloc]init];
    }
    return _three;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)switchView:(id)sender
{
    
    // 动画效果 (UIView简单切换动画)
    [UIView beginAnimations:@"ViewFilp" context:nil];
    [self.view insertSubview:self.one.view atIndex:0];
    [self.two.view removeFromSuperview];
    [self.three.view removeFromSuperview];
    [UIView setAnimationDuration:1.25];// 动画的时间
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
     [UIView commitAnimations];
   }
- (IBAction)switchView2:(id)sender
{
    


    // 动画效果 (UIView简单切换动画)
     [UIView beginAnimations:@"ViewFilp" context:nil];
    [self.view insertSubview:self.two.view atIndex:0];
    [self.one.view removeFromSuperview];
    [self.three.view removeFromSuperview];
    [UIView setAnimationDuration:1.25];// 动画的时间
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
     [UIView commitAnimations];
    }

- (IBAction)switchView3:(id)sender
{
    // 动画效果 (UIView简单切换动画)
    
    
    
     [UIView beginAnimations:@"ViewFilp" context:nil];
    [self.view insertSubview:self.three.view atIndex:0];
    [self.two.view removeFromSuperview];
    [self.one.view removeFromSuperview];
    [UIView setAnimationDuration:1.25];// 动画的时间
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
    [UIView commitAnimations];
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
